import Myrequest from '@/common/Myrequest.js';

// 获取文章类型
export const getList = ()=>{
	return Myrequest({
		URL:'/post/getList',
		Method:'GET'
	})
}
//删除图片
export const delImg = (id)=>{
	return Myrequest({
		URL:'/post/delImg',
		Method:'DELETE',
		Data:JSON.stringify(id)
	})
}
//获取评论列表
export const getComment = (data)=>{
	return Myrequest({
		URL:'/comment',
		Method:'GET',
		Data:data
	})
}
//发布评论
export const addComment = (data)=>{
	return Myrequest({
		URL:'/comment/AddComment',
		Method:'POST',
		Data:data
	})
}
//获取文章
//data:{id:分类id,current:页码}
export const getPostList = (data)=>{
	return Myrequest({
		URL:'/post/getPostByClassId',
		Method:'GET',
		Data:data
	})
}
//获取详情页
export const getPostDetail = (id)=>{
	return Myrequest({
		URL:'/post/getDetail',
		Method:'GET',
		Data:{id}
	})
}
//关注
export const addFollow = (data) =>{
	return Myrequest({
		URL:'/follow/add',
		Method:'POST',
		Data:data
	})
}
//取消关注
export const delFollow = (data) =>{
	return Myrequest({
		URL:'/follow/cancel',
		Method:'POST',
		Data:data
	})
}
//发布文章
export const publishPost = (data)=>{
	return Myrequest({
		URL:'/post/publish',
		Method:'POST',
		Data:data
	})
}

export const support = (data)=>{
	return Myrequest({
		URL:'/support',
		Method:'POST',
		Data:data
	})
}

//获取指定用户的文章
export const getPostByUserId  = (data)=>{
	return Myrequest({
		URL:'/post/getPostByUserId',
		Method:'GET',
		Data:data
	})
}

export const getisFollow = (data)=>{
	return Myrequest({
		URL:'/follow/isFollow',
		Method:'GET',
		Data:data
	})
}